package com.itheima.demo02;

public class Student implements Comparable<Student>{

    //name , chineseScore , mathScore ,
    //englishScore)
    private String name;
    private int chineseScore;
    private int mathScore;
    private int englishScore;

    public int getTotalScore(){
        return chineseScore + mathScore + englishScore;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getChineseScore() {
        return chineseScore;
    }

    public void setChineseScore(int chineseScore) {
        this.chineseScore = chineseScore;
    }

    public int getMathScore() {
        return mathScore;
    }

    public void setMathScore(int mathScore) {
        this.mathScore = mathScore;
    }

    public int getEnglishScore() {
        return englishScore;
    }

    public void setEnglishScore(int englishScore) {
        this.englishScore = englishScore;
    }

    @Override
    public int compareTo(Student o) {

        int i = o.chineseScore - this.chineseScore;
        int i1 = i == 0 ? o.mathScore - this.mathScore : i;
        int i2 = i1 == 0 ? o.name.compareTo(this.name) : i1;


        return i2;
    }
}
